#!/bin/sh
# Helper script to handle building libgauche.dylib on MacOSX
# Assumes $TARGETLIB is set by the caller.
set -e
CCLD=$1
shift
if echo "$*" | grep dynamiclib > /dev/null 2>&1 ; then
  libname=`echo "$*" | sed -n 's/.*-o  *\(libgauche-[0-9.]*\.dylib\).*/\1/p'`
  $CCLD -install_name "${TARGETLIB}/${libname}" "$@"
else
  $CCLD "$@"
fi
